package com.vinci.task.controller;


import com.vinci.task.entity.TbTaskCompletedBy;
import com.vinci.task.entity.TbTaskInfo;
import com.vinci.task.service.TbTaskCompletedByService;
import com.vinci.util.JsonObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 任务完成人 前端控制器
 * </p>
 *
 * @author 张先生
 * @since 2021-12-14
 */
@RestController
@RequestMapping("/task/CompletedBy")
@Slf4j
public class TbTaskCompletedByController {

    @Autowired
    private TbTaskCompletedByService tbTaskCompletedByService;

    /**
     * 我参与任务
     * @param userId
     * @return
     */
    @RequestMapping("/iAmInvolved")
    public JsonObject iAmInvolved(String userId){

        JsonObject jsonObject = new JsonObject();
        if(userId == null){
            jsonObject.setCode("A0400");
            jsonObject.setMsg("用户请求参数错误");
        }else {
            List<TbTaskInfo> tbTaskInfos = tbTaskCompletedByService.selectTaskCompletedByUserId(userId);
            jsonObject.setData(tbTaskInfos);
            jsonObject.setMsg("成功");
        }
        return jsonObject;
    }

}

